var status = 0;

function start() {
	status = -1;
	action(1, 0, 0);
}

function action(mode, type, selection) {
	if (mode == -1) {
		cm.dispose();
	} else {
		if (mode == 0) {
			if (cm.getChar().getMapId != 924000002)
				cm.sendOk("I understand it if you are scared.");
			else
				cm.warp(910000000);
   			cm.dispose();
   			return;
  		}
		if (mode == 1)
   			status++;
  		else
   			status--;
  		if (status == 0) {
			if (cm.getChar().getMapId() == 924000000) {
				if (cm.getChar().getParty() != null) {
					if (cm.getPartyMembers() > 3) {
						cm.sendYesNo("So, are you ready to go to the haunted area?");
					} else {
						cm.sendOk("Please make a party of at least 4 members");
						cm.dispose();
					}
				} else {
					cm.sendOk("Please make a party of at least 4 members");
					cm.dispose();
				}
			} else if (cm.getChar().getMapId() == 924000001) {
				cm.sendYesNo("If you are done hunting i can send your party to the boss map");
			} else if (cm.getChar().getMapId() == 910000000) {
				cm.sendYesNo("I can warp you to the haunted area\r\nAre you ready to go?");
			} else {
	   			cm.sendYesNo("Are you ready for the boss?");
			}
  		} else {
			if (cm.getChar().getMapId() == 924000000) {
				cm.warpParty(924000001);
				cm.dispose();
			} else if (cm.getChar().getMapId() == 924000001) {
				cm.warp(924000002);
				cm.dispose();
			} else if (cm.getChar().getMapId() == 910000000) {
				cm.warp(924000000);
				cm.dispose();
			} else {
				if (cm.countMonster() > 0) {
	   				cm.sendOk("The boss is already spawned, kill him first");
				} else {
					cm.spawnMob(9300176);
				}
				cm.dispose();
			}
  		}
	}
}